<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/


get_config_keytable("fax_Increase");
empty($do) && $do = 'list';
if ($do == 'list') {
	include_once('template/add.php');

}elseif ($do == 'save') {
	//$url1=str_replace("/","\\","D:/webs/");
    //$url2=str_replace("/","\\",$_GET[paths]);
	$savetype = getGP('savetype','P');
	$title = getGP('title','P');//发送主题
	$reserve1 = $_USER->id;//发送标识
	$sender1 = $_USER->name;//发送人
	$file1=str_replace("/","\\\\",getGP('file1','P'));
	//$file1=getGP('file1','P');
	//echo $file1;
	//exit;
	if(getGP('file2','P')!=''){
	$file2="|".str_replace("/","\\\\",getGP('file2','P'));;
	}
	if(getGP('file3','P')!=''){
	$file3="|".str_replace("/","\\\\",getGP('file3','P'));;
	}
	if (getGP('file1','P')!=''){
	$sendfile = $file1.$file2.$file3;//附件
	}else{
	$sendfile ="";//附件
	}
	$extinfo=getGP('extinfo','P');
	//================================
	$receiver1=getGP('receiver1','P');//收件人
	$fax=getGP('fax','P');//传真号
	//echo $sendfile;
	//exit;
	//获取字符串
	$smsfax=explode(',',$fax); 
	$smsreceiver1=explode(',',$receiver1); 
	
	//写入短信设备
	for($i=0;$i<sizeof($smsfax);$i++)
	{
	$starfax=explode('-',$smsfax[$i]); 
	$aofax_send_task = array(
		'title' => $title,
		'ic' => '86',
		'ldc' => $starfax[0],
		'fax' => $starfax[1],
		'sender1' => $sender1,
		'receiver1' => $smsreceiver1[$i],
		'sendfile' => $sendfile,
		'sendflag' => 0,
		'line' => 0,
		'status' => 0,
		'extinfo' => $extinfo,
		'reserve1' => $reserve1
	);
	insert_smsdb('aofax_send_task',$aofax_send_task);
	
	}
	//exit;
	$content=$title.get_inc_log(1).$receiver1.get_inc_log(1).$fax.get_inc_log(1).$sendfile.get_inc_log(1).$extinfo;
	$title='新增传真信息';
	get_oa_log_dbadd(1,$content,$title,16,$_USER->id);
	
    goto_page('admin.php?ac=refaxlist&fileurl=fax');

}
?>